export const constantRoutes = [
  {
    path: '/redirect',
    component: 'layout/Layout',
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: 'layout/Layout',
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index'),
        meta: { title: '首页', icon: 'dashboard' }
      }
    ]
  },

  {
    path: '/map',
    component: 'layout/Layout',
    children: [
      {
        path: 'index',
        name: 'Map',
        component: () => import('@/views/map/index'),
        meta: { title: '地图展示', icon: 'map', noCache: true }
      }
    ]
  }
]

export const asyncRoutes = [
  {
    path: '/setting',
    component: 'layout/Layout',
    children: [
      {
        path: 'index',
        name: 'setting',
        component: () => import('@/views/setting/index'),
        meta: {
          title: '标签管理',
          icon: 'setting',
          roles: ['admin']
        }
      }
    ]
  },

  {
    path: '/data',
    component: 'layout/Layout',
    redirect: '/data/report',
    meta: {
      title: '数据统计',
      icon: 'data'
    },
    children: [
      {
        path: 'report',
        component: () => import('@/views/data/report/index'), // Parent router-view
        name: 'Report',
        meta: { title: '数据报表', icon: 'report', roles: ['admin'] }
      },
      {
        path: 'battery',
        name: 'Battery',
        component: () => import('@/views/data/battery/index'),
        meta: { title: '电量信息', icon: 'battery' }
      },
      {
        path: 'temperature',
        name: 'Temperature',
        component: () => import('@/views/data/temperature/index'),
        meta: { title: '温度信息', icon: 'temperature' }
      },
      {
        path: 'event',
        name: 'Event',
        component: () => import('@/views/data/event/index'),
        meta: { title: '事件', icon: 'event', roles: ['admin'] }
      }
    ]
  },

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]
